import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
  DefaultValuePipe,
  ParseIntPipe,
} from '@nestjs/common';
import { BoxService } from 'src/service/box.service';
import { CreateBoxDto } from 'src/dto/create-box.dto';
import { UpdateBoxDto } from 'src/dto/update-box.dto';
import { QueryBoxDto } from 'src/dto/query-box.dto';

@Controller('admin/box')
export class BoxController {
  constructor(private readonly boxService: BoxService) {}

  @Post()
  create(@Body() createBoxDto: CreateBoxDto) {
    return this.boxService.create(createBoxDto);
  }

  @Get()
  query(@Query() query: QueryBoxDto) {
    return this.boxService.query(query);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.boxService.findOne(+id);
  }

  @Patch(':id')
  update(
    @Param('id') id: string,
    @Body() updateBoxDto: UpdateBoxDto,
  ) {
    return this.boxService.update(+id, updateBoxDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.boxService.remove(+id);
  }
}
